<?php

class Example_Controller_Category
    extends Example_Controller
{

    public function __construct(array $args = array( ))
    {
        global $wp_query;

        $main = new Example_Element_Site_Main(array(
            'contents' => array(

                'title' => new OOWP_Element(array(
                    'attributes' => array(
                        'class' => array(
                            'clearfix',
                            'grid_12',
                        ),
                        'id' => 'title',
                    ),
                    'contents' => array(
                        '<em>' . $wp_query->queried_object->name . '</em> Archives',
                    ),
                    'tag' => 'h1',
                )),

                'loop' => new OOWP_Loop(array(
                    'article_class' => 'Example_Element_Article_Excerpt_Post',
                )),

                'nav_below' => new OOWP_Element_Nav(array(
                    'attributes' => array(
                        'class' => array(
                            'clearfix',
                            'grid_12',
                        ),
                        'id' => 'nav-below',
                    ),
                    'contents' => array(
                        new OOWP_Element(array(
                            'attributes' => array(
                                'class' => array('pagination'),
                            ),
                            'contents' => array(new OOWP_Atom_PaginateLinks( ))
                        )),                
                    ),
                )), // nav-below

            ),
        ));

        $input = array_merge(array(
            'body' => new Example_Element_Site_Body(array(
                'contents' => array(
                    'main' => $main,
                ),
            )),
        ), $args);

        parent::__construct($input);
    }

    public static function matches(WP_Query $query)
    {
        if ($query->is_category && $query->is_archive) {
            return true;
        }
        return false;
    }

}
